package com.demo.controller;

import com.apidoc.annotation.Api;
import com.apidoc.annotation.LoginUser;
import com.apidoc.annotation.ParamIgnore;
import com.demo.bean.ForceVin;
import com.demo.bean.Page;
import com.demo.bean.ResEnv;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author mwl 2018-10-10
 * <p>
 * 书籍/漫画的相关接口
 * </p>
 **/
@Api("书籍/漫画接口")
@RestController
@RequestMapping(value = "/book/")
public class BookController {
    private static Logger logger = LoggerFactory.getLogger(BookController.class);

    /**
     * 书籍搜索(分类查询)
     *
     * @param bookName 书籍名
     * @param cid      小类(玄幻,都市,修仙...)
     * @param freeFlag 免费付费
     * @param page     页码(每页数量,后台定死)
     * @return
     */
    @RequestMapping("getPagedList")
    public ResEnv<Page<ForceVin>> getPagedList(HttpServletRequest request,
                                     HttpServletResponse response,
                                     @LoginUser String s,
                                     @RequestParam(value = "name", required = false) String bookName,
                                     Long cid,
                                     @RequestParam Long cid2,
                                     @RequestParam(value = "freeFlag", required = false) Boolean freeFlag,
                                     @RequestParam(value = "page", required = false, defaultValue = "1") Integer page) {
        try {

        } catch (Exception e) {
            logger.error("书籍搜索出错:{}", e.getMessage());
            e.printStackTrace();

        }
        return ResEnv.success();
    }
    /*
     * 书籍搜索(分类查询)
     *
     * @param bookName 书籍名
     * @param cid      小类(玄幻,都市,修仙...)
     * @param freeFlag 免费付费
     * @param page     页码(每页数量,后台定死)
     * @return
     */
    @RequestMapping("getPagedList2")
    public ResEnv<Page> getPagedList2(HttpServletRequest request,
                               HttpServletResponse response,
                               @LoginUser String s,
                               @RequestParam(value = "name", required = false) String bookName,
                               Long cid,
                               @RequestParam Long cid2,
                               @RequestParam(value = "freeFlag", required = false) Boolean freeFlag,
                               @RequestParam(value = "page", required = false, defaultValue = "1") Integer page) {
        try {

        } catch (Exception e) {
            logger.error("书籍搜索出错:{}", e.getMessage());
            e.printStackTrace();

        }
        return ResEnv.success();
    }
}
